package com.sq.universe.flowable.conf;

import com.google.common.collect.Maps;
import com.sq.universe.flowable.service.impl.FlowableBaseEventListenerImpl;
import lombok.extern.slf4j.Slf4j;
import org.flowable.common.engine.api.delegate.event.FlowableEventListener;
import org.flowable.engine.RuntimeService;
import org.flowable.spring.SpringProcessEngineConfiguration;
import org.flowable.spring.boot.EngineConfigurationConfigurer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;

/**
 * flowable 全局监听器配置类
 * @author: Lu Yang
 */
@Slf4j
@Component
@Configuration
public class FlowableListenerConfig implements CommandLineRunner {

    @Autowired
    private RuntimeService runtimeService;
    @Autowired
    private FlowableBaseEventListenerImpl flowableBaseEventListener;

    @Override
    public void run(String... args) {
        runtimeService.addEventListener(flowableBaseEventListener);
    }

}